package leetcode_2401_2500;

public class LeeCode_2482 {
    public static void main(String[] args) {

    }
    private static int[][] onesMinusZeros(int[][] grid) {
        int m = grid.length, n = grid[0].length;
        int[][] tm = new int[m][2];
        int[][] tn = new int[n][2];
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (grid[i][j] == 0){
                    tm[i][0]++;
                    tn[j][0]++;
                }else {
                    tm[i][1]++;
                    tn[j][1]++;
                }
            }
        }
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                grid[i][j] = tm[i][1] + tn[j][1] - tm[i][0] - tn[j][0];
            }
        }
        return grid;
    }
}
